package com.link2room.aeriabots.controller.inside;

import com.link2room.aeriabots.dto.param.inside.WxFansInsideParamDto;
import com.link2room.aeriabots.dto.result.base.WxFansInsideResDto;
import com.link2room.aeriabots.facade.IWxFansFacadeService;
import com.link2room.common.dto.result.base.BaseResultDto;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * Created by LN on 2016/10/17.
 */
@Api(tags = {"微信粉丝"})
@RestController
@RequestMapping("/in/WxFans")
public class WxFansInsideController {
    @Resource
    private IWxFansFacadeService wxFansFacadeService;

    @RequestMapping(method = RequestMethod.GET)
    @ApiOperation(value = "微信openid", response = WxFansInsideResDto.class)
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "openid", required = true, value = "openid", dataType = "String", paramType = "query"),
    })
    public BaseResultDto getWxFans(
            @RequestParam(name = "openid") String openid
    ) throws Exception {
        WxFansInsideParamDto paramDto = new WxFansInsideParamDto();
        paramDto.setOpenid(openid);
        WxFansInsideResDto res = wxFansFacadeService.getWxFans(paramDto);
        BaseResultDto resDto = new BaseResultDto();
        resDto.setResultCode(0);
        resDto.setResultInfo(res);
        return resDto;
    }
}
